﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects.DataClasses;
using System.Data.Objects;
using ThanNhanTao.Server.Enum;

namespace ThanNhanTao.Server
{
    public partial class bvdn_thannhantaoEntities : ObjectContext
    {

    }

    public partial class ChiDinh : EntityObject
    {
        private string yeuCau;
        public string TenYeuCau
        {
            get
            {
                return yeuCau;
            }
            set
            {
                yeuCau = value;
            }
        }

        private string tenDonViTinh;
        public string TenDonViTinh
        {
            get
            {
                return tenDonViTinh;
            }
            set
            {
                tenDonViTinh = value;
            }
        }

        private string tenLoaiYeuCau;
        public string TenLoaiYeuCau
        {
            get
            {
                return tenLoaiYeuCau;
            }
            set
            {
                tenLoaiYeuCau = value;
            }
        }
    }

    public partial class Dm_YeuCau : EntityObject
    {
        private bool checkItem;
        public bool CheckItem
        {
            get
            {
                return checkItem;
            }
            set
            {
                checkItem = value;
            }
        }

        public override string ToString()
        {
            return TenYeuCau;
        }
    }

    public partial class Dm_BenhVien : EntityObject
    {
        public override string ToString()
        {
            return TenBV;
        }
    }

    public partial class BenhNhan : EntityObject
    {
        public override string ToString()
        {
            return (Ho + " " + Ten);
        }

        public string TextTinhHinhTuVong
        {
            get 
            {
                string bResult = "";
                try
                {
                    if (TinhHinhTuVong==EnumTuVong.TuVong)
                    {
                        bResult = EnumTuVong.TuVongString;
                    }
                    else if (TinhHinhTuVong==EnumTuVong.TamDung)
                    {
                        bResult = EnumTuVong.TamDungString;
                    }
                    else if (TinhHinhTuVong == EnumTuVong.NangXinVe)
                    {
                        bResult = EnumTuVong.NangXinVeString;
                    }
                }
                catch (Exception) { }

                return bResult;
            }
        }

        public string TrangThaiDieuTri
        {
            get
            {
                if (NgayVaoVien == null)
                    return string.Empty;
                if(NgayRaVien == null)
                    return EnumTrangThaiBenhNhan.DangDieuTriString;
                else
                {
                    DateTime ngayHienTai = DateTime.UtcNow;
                    if (NgayRaVien.Value > ngayHienTai)
                        return EnumTrangThaiBenhNhan.DangDieuTriString;
                    else
                        return EnumTrangThaiBenhNhan.DaXuatVienString;

                }
            }
        }
    }

    public partial class Dm_DanToc : EntityObject
    {
        public override string ToString()
        {
            return TenDanToc;
        }
    }
}
